<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Cache-Control" content="no-cache" />
<meta http-equiv="Progma" content="no-cache" />
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/mm_training.css" type="text/css" />
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/user.css" type="text/css" />
<link type="text/css" href="<%=request.getContextPath()%>/css/smoothness/jquery-ui-1.7.1.custom.css" rel="stylesheet" />
<script type="text/javascript" src="<%=request.getContextPath()%>/scripts/jquery/jquery-1.3.2.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/scripts/jquery/jquery-ui-1.7.1.custom.js"></script>
<script type="text/javascript">
	/** 重命名jQuery */
	$j = jQuery.noConflict();
</script>
<script type="text/javascript" src="<%=request.getContextPath()%>/scripts/prototype/prototype-1.6.0.3.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/scripts/XunjiaUtils.js"></script>
<script type="text/javascript">
	/**
	 *
	 * 创建关键字广告'下一步'按钮
	 *
	 *
	 */
	function goNextPage() {
		// 获取协议类型
		var protocol = $("#protocol").text();
		// 获取宣传网址
		var weblinkVal = $("#weblink").val();
		// 设置处理数据为协议+宣传网址
		$("#weblink").val(protocol + weblinkVal);
		// 提交
		return true;
	}

	/**
	 *
	 * '上一步'按钮
	 * 
	 * 返回基本资料填写页面*
	 *
	 */
	function goPreviousPage() {
		document.location.replace("goRegiste.do");
	}
</script>
<style type="text/css">
td {
	font-size: 12px;
}

span {
	color: red;
}

body {
	font-size: 12px;
}

.err_msg {
	color: red;
}
</style>
<title>建立广告</title>
</head>
<body bgcolor="#64748B">
<form id="keywordsForm" action="<%=request.getContextPath()%>/registion/createKeywords.do" enctype="application/x-www-form-urlencoded" id="registionForm" name="registionForm" method="POST">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr bgcolor="#26354A">
		<td width="15" nowrap="nowrap"><img src="<%=request.getContextPath()%>/images/mm_spacer.gif" alt="" width="15" height="1" border="0" /></td>
		<td height="70" colspan="3" class="logo" nowrap="nowrap">Yam廣告聯盟<span class="tagline">| yam of sichuan</span></td>
		<td width="40">&nbsp;</td>
		<td width="100%">&nbsp;</td>
	</tr>
	<tr bgcolor="#FF6600">
		<td colspan="6"><img src="<%=request.getContextPath()%>/images/mm_spacer.gif" alt="" width="1" height="4" border="0" /></td>
	</tr>
	<tr bgcolor="#D3DCE6">
		<td colspan="6"><img src="<%=request.getContextPath()%>/images/mm_spacer.gif" alt="" width="1" height="1" border="0" /></td>
	</tr>
	<tr bgcolor="#FFCC00">
		<td width="15" nowrap="nowrap">&nbsp;</td>
		<td width="705" colspan="3" height="24">
		<table border="0" cellpadding="0" cellspacing="0" id="navigation">
			<tr>
				<td class="navText" align="center" nowrap="nowrap"><a href="<%=request.getContextPath()%>/index.do">返回首页</a></td>
				<td class="navText" align="center" nowrap="nowrap"></td>
				<td class="navText" align="center" nowrap="nowrap"></td>
				<td class="navText" align="center" nowrap="nowrap"></td>
				<td class="navText" align="center" nowrap="nowrap"></td>
				<td class="navText" align="center" nowrap="nowrap"></td>
			</tr>
		</table>
		</td>
		<td width="40"></td>
		<td width="100%"></td>
	</tr>
	<tr bgcolor="#D3DCE6">
		<td colspan="6"><img src="<%=request.getContextPath()%>/images/mm_spacer.gif" alt="" width="1" height="1" border="0" /></td>
	</tr>
	<tr bgcolor="#FF6600">
		<td colspan="6"><img src="<%=request.getContextPath()%>/images/mm_spacer.gif" alt="" width="1" height="4" border="0" /></td>
	</tr>
	<tr bgcolor="#D3DCE6">
		<td width="230" valign="top" bgcolor="#26354a" colspan="2">
		<table width="230" bgcolor="#26354a" cellspacing="0" cellpadding="0" border="0">
			<tr>
				<td width="230" class="pageName" style="font-size: 14px;"><a href="#">建立关键字广告</a></td>
			</tr>
			<tr>
				<td width="230" class="pageName" style="font-size: 14px;"><a href="<%=request.getContextPath()%>/registion/img.do?previous=userDetail">建立图片广告</a></td>
			</tr>
		</table>
		</td>
		<td width="50" valign="top"><img width="50" height="1" border="0" alt="" src="<%=request.getContextPath()%>/images/mm_spacer.gif" /></td>
		<td width="440" valign="top">
		<table width="721" border="0" bgcolor="#D3DCE6" align="center" cellpadding="0" cellspacing="0">
			<tr>
				<td width="51%" align="left" colspan="2" style="font-size: 16px">建立关键字广告</td>
			</tr>
			<tr>
				<td width="10%" align="left">广告预算<span style="color: red;">*</span></td>
				<td width="51%" align="left"><input type="radio" name="budget" value="100" <s:if test="'100'.equals(budget)">checked="checked"</s:if> />每日NT$100(建议至少20组关键字)<br />
				<input type="radio" name="budget" value="200" <s:if test="'200'.equals(budget)">checked="checked"</s:if> />每日NT$200(建议至少30组关键字)<br />
				<input type="radio" name="budget" value="300" <s:if test="'300'.equals(budget)">checked="checked"</s:if> />每日NT$300(建议至少40组关键字)<br />
				<input type="radio" name="budget" <s:if test="'on'.equals(budget)">checked="checked"</s:if> value="on" />每日NT$<input type="text" name="customBudget" id="customBudget" value="<s:property value="customBudget"/>" />若每日预算大于NT$300,请自行输入(建议至少20组关键字)<s:fielderror fieldName="budget" /><s:fielderror fieldName="customBudget" /></td>
			</tr>
			<tr>
				<td width="51%" align="left">预估每月花费</td>
				<td width="51%" align="left"><input type="text" name="costPerMonth" id="costPerMonth" value="<s:property value="costPerMonth"/>" /><s:fielderror fieldName="costPerMonth" /></td>
			</tr>
			<tr>
				<td width="51%" align="left">你要宣传的网页<span>*</span></td>
				<td width="51%" align="left"><span id="protocol"></span><input type="text" name="weblink" id="weblink" value="<s:property value="weblink"/>" />范例:http://www.sina.com.cn<s:fielderror fieldName="weblink" /></td>
			</tr>
			<tr>
				<td width="51%" align="left">标题(限8-15)<span>*</span></td>
				<td width="51%" align="left"><input type="text" name="title" id="title" value="<s:property value="title"/>" /><s:fielderror fieldName="title" /></td>
			</tr>
			<tr>
				<td width="51%" align="left">内容描述(限24-38)<span>*</span></td>
				<td width="51%" align="left"><input type="text" name="desc" id="desc" value="<s:property value="desc"/>" /><s:fielderror fieldName="desc" /></td>
			</tr>
			<tr>
				<td width="51%" align="left">你的文字广告</td>
				<td width="51%" align="left">
				<div>你的文字广告</div>
				</td>
			</tr>
			<tr>
				<td width="51%" align="left" valign="top">选择关键字<span>*</span><br />
				限50组</td>
				<td width="51%" align="left"><textarea rows="5" cols="30" name="keywords" id="keywords"><s:property value="keywords" /></textarea><s:fielderror fieldName="keywords" /><br />
				一行輸入一個關鍵字,在輸入下一個關鍵字前請按"Enter",不使用標點符號,范例: 面膜 眼霜 手機<br />
				<input type="button" name="relateWord" id="relateWord" value="相关字" /></td>
			</tr>
			<tr>
				<td width="51%" align="right"><input type="button" name="preStep" id="preStep" value="上一步" onclick=
	goPreviousPage();;;;;
/></td>
				<td width="51%" align="left"><input type="submit" name="nextStep" id="nextStep" value="下一步" /></td>
			</tr>
		</table>
		</td>
		<td width="40">&nbsp;<input type="hidden" name="previous" id="previous" value="<s:property value="previous"/>"/> </td>
		<td width="100%">&nbsp;</td>
	</tr>
	<tr bgcolor="#D3DCE6">
		<td colspan="6"><img src="<%=request.getContextPath()%>/images/mm_spacer.gif" width="1" height="1" border="0" /></td>
	</tr>
</table>
</form>
<script type="text/javascript">
	function init() {
		// 获取关键字广告对象
		var cookieInfo = CookieUtils.getJSONValue('COOKIE_REGISTE_ADVERTISEMENT_KEYWORDS');
		// 获取广告活动对象
		var advertisementActivity = CookieUtils.getJSONValue('COOKIE_REGISTE_ADVERTISEMENT_ACTIVITY');
		// 每日最高消费金额
		var maxPayPerDay = StringUtils.getString(advertisementActivity.maxPayPerDay);
		// 查看每日消费预算
		switch (maxPayPerDay) {
		case 100:
			$j(":radio[value='100']").attr("checked", "checked");
			break;
		case 200:
			$j(":radio[value='200']").attr("checked", "checked");
			break;
		case 300:
			$j(":radio[value='300']").attr("checked", "checked");
			break;
		default:
			$j(":radio[value='on']").attr("checked", "checked");
			$j("#customBudget").val(maxPayPerDay);
			break;
		}
		// 每月消费预算
		$j("#costPerMonth").val(StringUtils.getString(advertisementActivity.costPerMonth));
		// 链接地址
		$j("#weblink").val(StringUtils.getString(cookieInfo.href));
		// 广告标题 
		$j("#title").val(StringUtils.getString(cookieInfo.title));
		// 广告内容
		$j("#desc").val(StringUtils.getString(cookieInfo.content));
		// 关键字
		var cookieKeywordsList = eval(CookieUtils.getStringValue('COOKIE_REGISTE_KEYWORDS_LIST'));
		if (!StringUtils.isEmpty(cookieKeywordsList)) {
			// 设置关键字
			$j("#keywords").val(cookieKeywordsList.join("\n"));
		}
	}
	init();
</script>
</body>
</html>